#pragma once
#include "GameComponent.h"
#include "Matrix44.h"

namespace Boon
{
namespace Physics{ class IPhysics; }

class BOON_API Transform : public GameComponent
{
	GAMECOMPONENT( Transform, GameComponent )

	virtual void			OnCreate() sealed;
	virtual void			OnEnable() sealed;
	virtual void			Update() sealed;
	virtual void			OnStart() sealed;
	virtual void			LateUpdate() sealed;
	virtual void			OnDisable() sealed;
	virtual void			OnDestroy() sealed;

public:
	const Matrix44&			GetMatrixToWorld() const;
	const Matrix44&			GetMatrixFromWorld() const;
	const Vector3			GetPosition() const;
	void					SetPosition( const Vector3& position );
	void					SetPosition( float x, float y, float z );
	const Quaternion&		GetRotation() const;
	void					SetRotation( const Quaternion& q );
	void					Rotate( float angle, const Vector3& axis = Vector3::FORWARD );
	void					Translate( const Vector3& direction );

private:

	Matrix44				m_FromWorld;
	Matrix44				m_ToWorld;
	bool					m_IsDirty;
	Physics::IPhysics*		m_physics;
	Quaternion				m_Rotation;

	friend class Physics::NvidiaPhysX;
};

}
